<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html lang="en">
<head>
	<META name="viewport" content="width=device-width, initial-scale=1.0"> 
	<meta name="created" content="2018-10-23T06:18:10.521000000"/>
	<meta name="changed" content="2018-10-23T06:18:42.262000000"/>
	<META http-equiv="content-type" content="text/html; charset=UTF-8">
	<META http-equiv="Content-Language" content="en">
	<title>The Test Vector window</title>
</head>
<body bgcolor="FFFFFF">

<h1>The Test Vector window</h1>

<p>The Test Vector window is similar to the Table tab of the Logging
window. You can load a test vector from a file, and Logisim will start
running tests on the current circuit. Like the logging window, there
is only one test vector window for the project, and the table will
change to reflect whichever circuit is being simulated in the project
window. Note, however, that the Test Vector module runs a separate
copy of the circuit simulator, and so does not interfere with, and is
not influenced by, the simulation in the project window.</p>

<p>Any incorrect outputs will be flagged in red. Hover the mouse over
the red box to see what the output should have been, according to the
test vector. Rows with incorrect outputs are sorted to the top of the
window.</p>

<p>The file format is simple. You can use the Logging module (with
"Include Header Line" selected in the file output tab) to get started,
since in most cases the Logging module outputs the same format as used
by the Test Vector module.</p>

<p>Here is an example test vector file:.
<pre>
# my test vector for add32
A[32] B[32] C[32] Cin Cout
00000000000000000000000000000000        00000000000000000000000000000000        00000000000000000000000000000000        0       0
-2       0x00000005    3       0       0
0        0o0003        3       0       0
</pre>
</p>

<p>Blank lines are ignored.  Anything following a '#' character is a
comment.  The first non-blank, non-comment line lists the name of each
circuit input pin and its width (if &gt; 1), separated by whitespace.
</p>

<p>The remaining lines list each value separated by whitespace. The
values can be in hex, octal, binary, or signed decimal. Hex values
must have a '0x' prefix. Octal values must have a '0o' prefix.
Binary and decimal are be
distinguished by the number of digits: binary values must always have
exactly as many digits as the width of the column; decimal values must
always have fewer, should not have leading zeros, and may have a
negative sign.</p>

<p>For hex, octal, and binary values, a digit of 'x' specifies four,
three, or one "don't care" bits. So the value 101xx is a five bit
binary value, with the last two bits unspecified, and 0x1ax5 is a hex
value with four unspecified bits.  Such "don't cares" can not be used
in decimal notation.</p> 

<p><strong>Command line:</strong> To facilitate automated testing, the
test vector feature can be run from the command line, as follows:<br>
logisim -test &lt;circuitname&gt; &lt;vector.txt&gt; &lt;project.circ&gt;</p>

<p><b>Next:</b> <em><a href="../index.html"><em>User's Guide</em></a></em>.</p>

</body>
</html>
